package miracle.joker.design.mediator;

import java.util.ArrayList;
import java.util.List;

public class ChatRoom implements Mediator {
    private List<User> users = new ArrayList<>();

    public void registerUser(User user) {
        users.add(user);
    }

    public void sendMessage(User user, String message) {
        for (User u : users) {
            if (!u.equals(user)) {
                u.receiveMessage(message);
            }
        }
    }
}
